var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }
    status++;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.getMap().killAllMonsters(true);
            cm.curNodeEventEnd(true);
            cm.setInGameDirectionMode(true, false, true);
            cm.inGameDirectionEvent_SetAdditionalEffectVisibleForInGameDirection();
            cm.fieldEffect_InsertCanvas(1, 255, 0, 0, 0, 0, 0);
            cm.fieldEffect_PlayBGM("Bgm50/ThroneOfDarkness", 0, 0);
            cm.inGameDirectionEvent_AskAnswerTime(100)
        } else {
            if (status === a++) {
                cm.curNodeEventEnd(true);
                cm.fieldEffect_复合图片动画(["Effect/Direction20.img/bossBlackMage/start2_spine/skeleton", "animation", "", "intro"], [0, 0, 1, 0, 0, 0, 0, 1]);
                cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/BM3/boss_start2", 200);
                cm.inGameDirectionEvent_AskAnswerTime(5000)
            } else {
                if (status === a++) {
                    cm.fieldEffect_ProcessOnOffLayer("BlackOut", "Map/Effect2.img/BlackOut", 0, 1000, 0, 0, 13, 4, 1, -1, 0, 0, 0);
                    cm.inGameDirectionEvent_AskAnswerTime(1000)
                } else {
                    if (status === a++) {
                        cm.fieldEffect_取消复合图片动画("intro", 100, 0);
                        cm.fieldEffect_ProcessOnOffLayer("BlackOut", "", 2, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                        cm.onTeleport(0, 3, cm.getPlayer().getId(), -250, 21);
                        cm.inGameDirectionEvent_ForcedFlip(1);
                        cm.npc_ChangeController(3003932, "oid=2273124", 0, 0, 3, -50, 50, 1, false, 0, false);
                        cm.npc_SetSpecialAction("oid=2273124", "summon", 0, 0);
                        cm.inGameDirectionEvent_AskAnswerTime(3000)
                    } else {
                        if (status === a++) {
                            cm.fieldEffect_InsertCanvas(0, 0, 0, 0, 0, 3000, 0);
                            cm.inGameDirectionEvent_PushScaleInfo(0, 0, 1000, 0, 0, -80)
                        } else {
                            if (status === a++) {
                                cm.inGameDirectionEvent_AskAnswerTime(1000)
                            } else {
                                if (status === a++) {
                                    cm.inGameDirectionEvent_AskAnswerTime(240)
                                } else {
                                    if (status === a++) {
                                        cm.effect_Text(["#r#fn黑体##fs26#我看到了。名为均衡的锁链，以及束缚他的世界。"], [100, 3500, 4, 0, 0, 1, 4, 0, 0, 0, 0]);
                                        cm.effect_Voice("Voice4.img/BM3/black/10", 128);
                                        cm.inGameDirectionEvent_AskAnswerTime(6500)
                                    } else {
                                        if (status === a++) {
                                            cm.inGameDirectionEvent_AskAnswerTime(300)
                                        } else {
                                            if (status === a++) {
                                                cm.effect_Text(["#r#fn黑体##fs26#我看到了。倦怠的神，以及失去存在意义的人类。"], [100, 3500, 4, 0, 0, 1, 4, 0, 0, 0, 0]);
                                                cm.effect_Voice("Voice4.img/BM3/black/11", 128);
                                                cm.inGameDirectionEvent_AskAnswerTime(6500)
                                            } else {
                                                if (status === a++) {
                                                    cm.inGameDirectionEvent_AskAnswerTime(300)
                                                } else {
                                                    if (status === a++) {
                                                        cm.effect_Text(["#r#fn黑体##fs26#啊呀，对抗者啊，到完成命运的时候了。"], [100, 3500, 4, 0, 0, 1, 4, 0, 0, 0, 0]);
                                                        cm.effect_Voice("Voice4.img/BM3/black/12", 128);
                                                        cm.inGameDirectionEvent_AskAnswerTime(6500)
                                                    } else {
                                                        if (status === a++) {
                                                            cm.sendNormalTalk_Bottom("一决胜负吧，黑魔法师！", 57, 0, false, true)
                                                        } else {
                                                            if (status === a++) {
                                                                cm.inGameDirectionEvent_AskAnswerTime(1200)
                                                            } else {
                                                                if (status === a++) {
                                                                    cm.fieldEffect_InsertCanvas(1, 255, 0, 0, 0, 500, 0);
                                                                    cm.inGameDirectionEvent_AskAnswerTime(500)
                                                                } else {
                                                                    if (status === a++) {
                                                                        cm.setInGameDirectionMode(false, true, false);
                                                                        cm.npc_LeaveField("oid=2273124");
                                                                        cm.npc_LeaveField("oid=2273124");
                                                                        cm.dispose();
                                                                        cm.warp(450013830, 0, true)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};